//
//  AddChildViewControllers.m
//  UILbrary
//
//  Created by mac on 17/1/16.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "AddChildViewControllers.h"
#import "ChildViewControllers.h"

@interface AddChildViewControllers ()
@property (nonatomic, strong) ChildViewControllers *childVC;
@end
@implementation AddChildViewControllers

- (void)viewDidLoad{
    self.view.backgroundColor = [UIColor whiteColor];
    
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(50, 50, 300, 400)];
    view.backgroundColor = [UIColor redColor];
    [self.view addSubview:view];
    
//    [self addChildViewController:self.childVC];
//    [self.view addSubview:self.childVC.view];
//    [self.navigationController pushViewController:self.childVC animated:YES];
    [self presentViewController:self.childVC animated:YES completion:nil];
    
    //如果是present childVC 则看不到view 的红色背景。
}

#pragma mark - lazy method

- (ChildViewControllers *)childVC{
    if (!_childVC) {
        _childVC = [ChildViewControllers new];
    }
    return _childVC;
}
@end
